using System;
using System.Collections.Generic;
using System.Text;
using Google.GData.Contacts;
using Google.GData.Extensions;
using System.Diagnostics;

namespace GSync.GoogleSystem
{
    class GSItem
    {
        private String id;
        protected ContactEntry contact;

        public ContactEntry googleContact
        {
            get { return contact; }
            set { contact = value; }
        }
        public String Id
        {
            get { return id; }
            set { id = value; }
        }
        private String title;

        public String Title
        {
            get { return title; }
            set { title = value; }
        }

        //override this to check how two objects are equal
        public override bool Equals(Object o)
        {
            if (contact != null && o is GSItem)
            {
                return contact.Equals(((GSItem)o).googleContact);
            }
            else if (id != null)
            {
                return this.id.Equals(((GSItem)o).id);
            }
            else
            {
                return this.title.Equals(((GSItem)o).title);
            }

        }



        

        public override int GetHashCode()
        {
            if (contact != null)
            {
                return contact.GetHashCode();
            }
            else if (id != null)
            {
                return id.GetHashCode();
            }
            return title.GetHashCode();
        }


        public override String ToString()
        {
            return Title;
        }

    }
}
